' https://archive.org/details/mumble.qb64 ' Mumble Marble is the same as "Peg Solitaire" : http://people.se.cmich.edu/graha1sw/pub/pegsol/englishpegsol.pdf 5 DIM Array(87) 10 REM Mumble Marble 20 GOSUB 400 30 GOSUB 250 40 REM ACCEPT MOVE 50 COLOR 10: PRINT "Which marble do you want to move"; 60 INPUT A: COLOR 15 70 IF A = 99 THEN GOTO 240 80 IF A < 11 OR A > 77 THEN _ALERT("Invalid marble coordinate. Let's try again.") : GOTO 50 90 IF Array(A) <> 79 THEN _ALERT("Invalid marble coordinate. Let's try again.") : GOTO 50 100 COLOR 10: PRINT "From "; A; " to where"; 110 INPUT B: COLOR 15 120 IF B < 11 OR B > 77 THEN _ALERT("Invalid destination. Let's try again.") : GOTO 50 130 IF Array(B) <> E THEN _ALERT("Invalid destination. Let's try again.") : GOTO 50 IF ((A+B)/2) <> INT((A+B)/2) THEN _ALERT("Invalid move. Let's try again.") : GOTO 50 140 Array((A + B) / 2) = E : Array(A) = E : Array(B) = 79 150 LET MOVE = MOVE + 1 160 LET COUNT = 0 170 FOR F = 11 TO 75 '🔴 15 180 IF Array(F) = 79 THEN LET COUNT = COUNT + 1 190 NEXT F 200 GOSUB 250 210 PRINT "There are "; COUNT; " marbles on the board." 220 IF COUNT <> 1 THEN GOTO 40 230 IF Array(44) = 79 THEN PRINT "You did it, in just "; MOVE; " moves!": END 240 PRINT "The game is over, and you've failed!": END 250 REM print out 260 CLS: REM Put HOME here if your computer supports it 270 PRINT SPC(12); "Enter side coordinate (row) first. Enter 99 to concede." 280 PRINT: PRINT 290 COLOR 13: PRINT SPC(28); " 1 2 3 4 5 6 7": COLOR 15 310 FOR Y = 1 TO 7: COLOR 13: PRINT SPC(28); Y; " ";: COLOR 15 315 FOR X = 1 TO 7 320 D = Y * 10 + X: C$ = CHR$(Array(D)) 330 IF C$ = "O" THEN COLOR 11 ELSE COLOR 9 335 PRINT C$; " "; 340 NEXT X: PRINT 350 NEXT Y 360 PRINT: PRINT: PRINT 370 COLOR 12: PRINT "Moves so far: "; MOVE: COLOR 10 380 PRINT: PRINT 390 RETURN 400 REM INITIALISE 410 CLS: COLOR 15 430 LET E = 42 440 FOR D = 11 TO 77 ' 75 450 LET T = 10 * (INT(D / 10)) 460 IF D - T = 8 THEN LET D = D + 3 470 READ Array(D) 480 NEXT D 490 LET MOVE = 0 500 RETURN 510 REM 42 is ASC ("*") 520 REM 79 is ASC("O") 530 DATA 32,32,79,79,79,32,32 540 DATA 32,32,79,79,79,32,32 550 DATA 79,79,79,79,79,79,79 560 DATA 79,79,79,42,79,79,79 570 DATA 79,79,79,79,79,79,79 580 DATA 32,32,79,79,79,32,32 590 DATA 32,32,79,79,79,32,32